package com.changgou.goods.feign;

import com.changgou.goods.pojo.Sku;
import com.changgou.order.pojo.OrderItem;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "goods")
@RequestMapping("/sku")
public interface SkuFeign {

    @GetMapping("/status/{status}")
    Result<List<Sku>> findByStatus(@PathVariable(value = "status") String status);

    @GetMapping("/{id}")
    Result<Sku> findById(@PathVariable(value = "id") Long id);

    @PostMapping(value = "/decr/count")
    Result decrCount(@RequestParam(name = "username") String username);

    @PostMapping(value = "/rollback/count")
    Result rollBackCount(@RequestBody List<OrderItem> orderItems);

    /***
     * 多条件搜索品牌数据
     * @param sku
     * @return
     */
    @PostMapping(value = "/search" )
    Result<List<Sku>> findList(@RequestBody(required = false)  Sku sku);
}
